<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css"
	href="../EXT4/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css"
	href="../css/style.css" />
<script type="text/javascript" src="../EXT4/ext-all.js"></script>
<script type="text/javascript" src="../script/ext-lang-zh_CN.js"></script>
<script type="text/javascript">

Ext.onReady(function() {
    Ext.QuickTips.init();

    var required = '<span style="color:red;font-weight:bold" data-qtip="Required">*</span>';
    
    var top = Ext.widget({
        xtype: 'form',
        width: 600,
        collapsible: true,
        frame: true,
        title: '学生信息记录',
        bodyPadding: '5 5 0',
        fieldDefaults: {
            labelAlign: 'top',
            msgTarget: 'side'
        },

        items: [{
            xtype: 'container',
            anchor: '100%',
            layout: 'hbox',
            items:[{
                xtype: 'container',
                flex: 1,
                layout: 'anchor',
                items: [{
                    xtype:'textfield',
                    fieldLabel: '学生姓名',
                    afterLabelTextTpl: required,
                    allowBlank: false,
                    name: 'secuit.displayName',
                    anchor:'95%'
                }, {
                    xtype:'textfield',
                    fieldLabel: '年龄',
                    afterLabelTextTpl: required,
                    allowBlank: false,
                    name: 'secuit.age',
                    anchor:'95%'
                }, {
                    xtype: 'textfield',
                    name: 'secuit.school',
                    afterLabelTextTpl: required,
                    allowBlank: false,
                    fieldLabel: '学校',
                    anchor: '95%'
                }]
            },{
                xtype: 'container',
                flex: 1,
                layout: 'anchor',
                items: [{
                    xtype:'textfield',
                    fieldLabel: '联系电话',
                    afterLabelTextTpl: required,
                    allowBlank: false,
                    name: 'secuit.phont',
                    anchor:'100%'
                },{
                    xtype:'textfield',
                    fieldLabel: 'Email',
                    name: 'secuit.EMail',
                    vtype:'email',
                    anchor:'100%'
                }, {
                    xtype: 'datefield',
                    name: 'secuit.visitTime',
                    format: 'Y-m-d', 
                    afterLabelTextTpl: required,
                    fieldLabel: '到访时间',
                    allowBlank: false,
                    anchor: '100%'
                }]
            }]
        }],

        buttons: [{
            text: '保存',
            handler: function() {
       			this.up('form').getForm().submit({  
                    url : '../service/secuit_add',//请求的url地址  
                    method:'post',//请求方式
                    success:function(form,action){//加载成功的处理函数  
	                   	Ext.Msg.alert('提示', action.result.msg);
	                   	this.up('form').getForm().reset();
               		},
                    failure:function(form,action){//加载成功的处理函数  
  		        		Ext.Msg.alert('提示', action.result.msg); 
   		        	}
                });
        	}
        },{
            text: '清空',
            handler: function() {
                this.up('form').getForm().reset();
            }
        }]
    });

    top.render(Ext.getDom("secuitform"));

});

</script>
</head>
<body>
<div id="secuitform"></div>
</body>
</html>